<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="./css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="css/mine.css" />
		<style type="text/css">
			.mui-content .mui-scroll {
				margin-top: ;
			}

			.mui-table-view {
				margin-top: 1.25rem;
			}

			.minemessage {
				/* height: 5rem; */
			}

			.head-img {
				border-radius: 0.3125rem;
				width: 2.5rem;
				height: 2.5rem;
			}
			#quiryInfo{
				padding: 0.3125rem;
				width: 95%;
				margin: auto;
			}
		</style>
	</head>

	<body onload="body_onload()">
		<div class="mui-content">
			<div class="mui-scroll">
				<ul class="mui-table-view minemessage" id="minecontent">
					<li class="mui-table-view-cell mui-media">
						<a class="mui-navigate-right" href="##">
							<img class="mui-media-object mui-pull-left head-img" id="head_img" src="./images/touxiang.jpg">
							<div class="mui-media-body">
								<span>姓名：</span><span id="staffName"></span>
								<p class="mui-ellipsis">账号：<span id="staffAccount"></span></p>
							</div>
						</a>
					</li>
				</ul>
				<ul id="password" class="mui-table-view mui-table-view-chevron">
					<li class="mui-table-view-cell">
						<a href="javascript:;" class="mui-navigate-right">修改登录密码</a>
					</li>
				</ul>
				<ul class="mui-table-view">
					<li class="mui-table-view-cell">
						<a>电话<span id="phone" class="mui-pull-right"></span></a>
					</li>
					<li class="mui-table-view-cell">
						<a>工种<span id="workType" class="mui-pull-right"></span></a>
					</li>
					<li class="mui-table-view-cell">
						<a>身份证号<span id="idCard" class="mui-pull-right"></span></a>
					</li>
					<li class="mui-table-view-cell">
						<a>当前状态<span id="currentStatus" class="mui-pull-right"></span></a>
					</li>
					<li class="mui-table-view-cell">
						<a>注册码<span id="registrationCode" class="mui-pull-right"></span></a>
					</li>
				</ul>
			</div>
			<!-- <div class="mui-button-row">
				<button id="quiryInfo" type="button" class="mui-btn mui-btn-primary mui-btn-block" onclick="return false;" style="margin-top: 27rem;">查看个人信息</button>&nbsp;&nbsp;
			</div> -->
		</div>



		<script src="./js/mui.min.js"></script>
		<script src="./js/jquery-2.1.1.min.js" type="text/javascript" charset="utf-8"></script>
		<!-- <script src="http://103.59.149.116:6198/hcys/js/mapi.js" type="text/javascript" charset="utf-8"></script> -->
		<script src="js/Mobile.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/app.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			mui.init({
				keyEventBind: {
					backbutton: false //关闭back按键监听
				}
			});
			
			// 按两次返回键退出APP
			function body_onload() {
				mui.plusReady(function() {
					plus.key.addEventListener("backbutton", function() {
						mui.toast('再按一次退出应用',{ duration:'long', type:'div' });
						setTimeout(function(){
							plus.key.removeEventListener("backbutton",function(){});
						},3000);
						plus.key.addEventListener("backbutton", function() {
							plus.runtime.quit();
							plus.webview.close(plus.webview.all());
						}, false);
					}, false);
				})
			}
			
			
			// 显示个人信息
			mui.plusReady(function () {
				window.addEventListener('minelists',function(event){
					var glbToken = event.detail.glbToken;
					var staffId = event.detail.staffId;
					if (checkToken(glbToken).status == "ok") {
						// // var glbToken = myStorage.glbToken;
						// var staffId = myStorage.staffid;
						// var glbToken = myStorage.glbToken;
						// var staffId = myStorage.staffid;
						var userInfo = getStaffInfo(staffId, glbToken);
						var url = "http://103.59.149.116:6198/lnhy/";
						var imgUrl = userInfo.StaffImage;
						if (imgUrl != "") {
							if (imgUrl.substr(0, 2) == "..") {
								imgUrl = imgUrl.substr(2);
							}
							// $("#head-img").attr("src", url + imgUrl);
							setTimeout(function(){
								$("#head_img").attr("src", url + imgUrl);
							},1000)
						}
						var staffName = document.getElementById("staffName");
						staffName.innerText = userInfo.StaffName;
						var staffAccount = document.getElementById("staffAccount");
						staffAccount.innerText = userInfo.StaffAccount;
						var phone = document.getElementById("phone");
						phone.innerText = userInfo.Phone;
						var workType = document.getElementById("workType");
						workType.innerText = userInfo.WorkTypes;
						var idCard = document.getElementById("idCard");
						idCard.innerText = userInfo.IDNumber;
						var currentStatus = document.getElementById("currentStatus");
						currentStatus.innerText = userInfo.StaffStatus;
						var registrationCode = document.getElementById("registrationCode");
						// registrationCode.innerText = userInfo.KeyStr;
						if (typeof userInfo.KeyStr != "undefined") {
							var len = userInfo.KeyStr.length-3-2;
							var xing = "";
							for (var i = 0; i < len; i++) {
								xing  += "*";
							}
							registrationCode.innerText = userInfo.KeyStr.substring(0, 3) + xing + userInfo.KeyStr.substring(userInfo.KeyStr.length-2);
						} else{
							alert('请稍后再试');
						};
					} else{
						app.setState({});
						plus.webview.getLaunchWebview().show("pop-in");
						setTimeout(function(){
							alert("此账号已在其他设备登录,请重新登录!");
							localStorage.clear();
							plus.runtime.restart();
						},30);
					}
				})
				
				// $("#quiryInfo").click(function(){
				// 	// $("#quiryInfo").hide();
				// 	var myStorage = JSON.parse(localStorage.getItem("users"));
				// 	var glbToken = myStorage.glbToken;
					
				// })
				
					
				mui("#minecontent").on("tap", "a", function() {
					mui.openWindow({
						url: "minemessage.html",
						id: "minemessage.html",
					})
				});
				mui("#password").on("tap","a",function(){
					mui.openWindow({
						url: "updatePassword.html",
						id: "updatePassword.html"
					})
				})
			})
			
			// })
			// var myStorage = JSON.parse(localStorage.getItem("users"));
			
		</script>
	</body>

</html>
